from django.db import models


# Create your models here.
# 作者 name age gender

class Author(models.Model):
    GENDER = [('1', 'male'), ('2', 'female')]
    name = models.CharField(max_length=20, blank=False, verbose_name='姓名')
    age = models.IntegerField()
    gender = models.CharField(choices=GENDER, max_length=1)

    def __str__(self):
        return self.name


class Blog(models.Model):
    title = models.CharField(max_length=255, verbose_name='标题')
    content = models.TextField(verbose_name='内容')
    author = models.ForeignKey(Author, on_delete=models.CASCADE, default=1, null=True, blank=True)
